﻿CREATE TRIGGER [dbo].[trd_Loan]
ON [dbo].[t_Loan]
FOR DELETE
AS

DELETE  CF_E FROM usix.t_CustomerFile_Export CF_E
INNER JOIN deleted d ON CF_E.LoanID = d.ID

UPDATE U SET LoanID = NULL
FROM t_Upload U INNER JOIN deleted d ON U.LoanID = d.ID